package bairui.international.weixin.portal.miniapp.controller.pay.order;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;

import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.sh_lianjing.json.jackson.util.Util_Json;
import com.sh_lianjing.wx.pay.model.Model_UnifiedorderReturn;
import com.sh_lianjing.wx.util.Util_Xml;

import bairui.international.service.Service_ProductOrder;

/**
 *
 * 支付通知
 *
 * @generated
 * 
 * @see STest_C_Pay_Order_Notify_Get 测试
 *
 */
@Controller
public class C_Pay_Order_Notify_Get
 extends SC_Pay_Order_Notify_Get 
{    

	@Autowired private Service_ProductOrder service_ProductOrder;

	/**
	 * Get请求
	 */
	@Action(Get.class)
	@PostMapping(Get.RequestMappingValue)
	public void get(
		ModelMap map, HttpServletRequest request
	) throws Exception {
		Model_UnifiedorderReturn xml = Util_Xml.toXmlObject(request.getInputStream(), Model_UnifiedorderReturn.class);
//		System.out.println(xml.toXml(true) + "============接收到的结果==========");
		if(xml.isSuccess()){
			String orderNumber = xml.getAttach();
			service_ProductOrder.onLinePay(orderNumber);
		}else{
			System.out.println(Util_Json.toJson(xml.gainErrorData(), true) + "=============错误信息==========");
		}
	}

}
